package MonthGame.problem1;

import java.util.Scanner;

public class City {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long t = s.nextLong();
        for(long i=0;i<t;i++){
            long n = s.nextLong();
            long x = s.nextLong();
            long y = s.nextLong();
            if(x<=(2*n-1)*y) System.out.println(2*n*y*2);
            else System.out.println(2*n*y*2+(x-y*(2*n-1)));
        }
    }
}
